Supplementary file 1 was manually split into 3 files (alphabetically based on the name of State/UT of origin): 1.txt, 2.txt and 3.txt
Each file was then passed through 'Code1.py' and 'Code2.py' respectively

########### Code1.py: Count Variant count per State/UT per month ###########
a = open ('Input_file.txt') # Files 1.txt, 2.txt and 3.txt were used as input files individually
a = a.readlines()
del a [0:1]
#print (a)
ID={}
new_out = open ('out.txt','w')#Files Out1.txt, Out2.txt and Out3.txt were output files invidually
for line in a:
    line = line.rstrip()
    line = line.split('\t')
    n = line[1] + '|' + line[2] + '|' + line[3]
    ID[n] = ID.get(n,0) + 1
print (ID)
new_out.write('State' + '\t' + 'Date' + '\t' +'WHO Variant' + '\t' + 'count' + '\n')
for k,v in ID.items():
     k = k.split('|')
     new_out.write (k[0] + '\t' + k[1] + '\t' + k[2] + '\t' + str(v) + '\n')
new_out.close()



########### Code2.py: Generate Plots ###########
import pandas as pd
import numpy as np
from pandas.api.types import CategoricalDtype
from plotnine import *
from datetime import datetime

a = pd.read_csv ("file.txt", delimiter = "\t") #Out1.txt, Out2.txt and Out3.txt were used as input files individually
a['Date'] = pd.to_datetime(a['Date'])
limits = a['Date'].min(), a['Date'].max()
limits = list(limits)
limits[0] = limits[0].replace(month = 1)
limits = tuple(limits)
a ['count_log2'] = np.log2(a['count'])


color = {"Alpha" : "#009933", "Beta" : "#0000FF", "Delta" : "#D10000", "Eta" : "#FFFF00", "Gamma" : "#990099", "Iota" : "#FFC20A", "Kappa" : "#FF00FF" , "Others" : "#000000"} ## Coloring scheme

ggplot (a) + aes (x = 'Date', y = 'count_log2', color = 'WHO_clade') + geom_point(size = 2, alpha = 1) + facet_wrap('State', nrow= 4)  + theme_bw() + theme(axis_text_x= element_text (angle = 90, size = 9), axis_title= element_text(size = 20), strip_text_x= element_text(face = "bold", size = 12), legend_position= 'right', legend_title_align='center', legend_box_margin= 5, legend_background= element_rect(color = 'black', size = 0.5, fill = "white"), legend_title=element_text (face = "bold"), subplots_adjust={'hspace': 0.5, 'right': .86}, strip_background=element_rect(color="black", fill="#D3D3D3", size=1, alpha=1)) + scale_x_date(date_labels = "%b-%y", date_breaks = "1 month", limits = limits) + scale_color_manual(values=color) + labs (x = "Month of Isolation (MM-YY)", y = "Variant count (scale to log2)")
